package activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.example.administrator.gongxiangcheng.R;
import com.recker.flybanner.FlyBanner;

import java.util.ArrayList;
import java.util.List;

import adapter.RecyAdapter;


/**
 * Created by Administrator on 2017/3/27.
 */
public class mineZuiXinActivity extends Activity {
    private FlyBanner flyBanner;
    private ImageView imageView;
    private RecyclerView recyclerView;
    private LinearLayoutManager mLayoutManager;
    private RecyAdapter mAdapter;
    private List<String> mData;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.minezuixin_main);
        imageView = (ImageView) findViewById(R.id.mine_zui_xin_iv);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        /**
         * 加载本地图片
         */
        flyBanner = (FlyBanner) findViewById(R.id.banner_1);
        List<Integer> images = new ArrayList<>();
        images.add(R.drawable.a);
        images.add(R.drawable.b);
        images.add(R.drawable.c);
        images.add(R.drawable.d);
        images.add(R.drawable.b);
        flyBanner.setImages(images);

        flyBanner.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Intent intent = new Intent(mineZuiXinActivity.this,mineXqActivity.class);
                  startActivity(intent);
            }
        });
        mData = new ArrayList<>();
        for(int i=0;i<20;i++){
            mData.add("Item "+i);
        }

        recyclerView = (RecyclerView) findViewById(R.id.My_recyclerView);
        mLayoutManager = new LinearLayoutManager(this);
        //2 为RecyclerView创建布局管理器，这里使用的是LinearLayoutManager，表示里面的Item排列是线性排列
        recyclerView.setLayoutManager(mLayoutManager);
        mAdapter = new RecyAdapter(mData);
        //3 设置数据适配器
        recyclerView.setAdapter(mAdapter);







    }
}
